<template>
   <van-tabbar route active-color="#dd524d" v-if="isTabbar">
    <van-tabbar-item replace to="/home" icon="wap-home-o">首页</van-tabbar-item>
    <van-tabbar-item replace to="/category" icon="qr">分类</van-tabbar-item>
    <van-tabbar-item replace :badge="cartLength"  to="/shopcar" icon="cart-o">购物车</van-tabbar-item>
    <van-tabbar-item replace to="/user" icon="contact" >我的</van-tabbar-item>
  </van-tabbar>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  name: 'Tabbar',
  computed: {
    ...mapGetters(['cartLength']),
    isTabbar () {
      return this.$route.path !== '/user/login' && this.$route.path !== '/user/register'
    }
  }
}
</script>

<style lang='scss' scoped>
</style>
